import React, { memo } from 'react';
import sty from './sty.module.css';
import { Pagination } from 'antd'
import PropTypes from 'prop-types'
const WPagintion = (props) => {
  const { currentPage, total, onPageChange, pageSize } = props;

  const itemRender = (current, type, originEle) => {

    if (type === 'prev') {
      return <button className={sty.control}>&lt;上一页</button>
    }
    if (type === 'next') {
      return <button className={sty.control}>下一页&gt;</button>
    }
    return originEle
  }

  return <Pagination className={sty.pagination}
    size='small'
    current={currentPage}
    defaultCurrent={1}
    total={total}
    pageSize={pageSize}
    showSizeChanger={false}
    itemRender={itemRender}
    onChange={onPageChange}

  >

  </Pagination>

}
WPagintion.propTypes = {
  total: PropTypes.number,
  onPageChange: PropTypes.func,
  currentPage: PropTypes.number,
  pageSize: PropTypes.number
}
WPagintion.defaultProps = {
  pageSize: 15
}
export default memo(WPagintion)